Skip to content

Conversation

bahamat
Copy link

@bahamat bahamat commented Dec 21, 2024

The "bare minimum" example has (among other things) this:

    let server = ServerBuilder::new(api, Arc::new(()), log)
        .start()
        .map_err(|error| format!("failed to start server: {}", error))?;

Then later the examples for registering APIs (both as a free function and as an API trait) don't wrap the argument in Arc<>.

This leads new users into a trap where these two (three) disconnected examples seem like they should work, but lead to a compile error once they add a handler.

Discussing with @davepacheco, it seems the consensus is that Arc is not particularly recommended here anymore.

This change will help new users walk right into a working example, rather than encountering an error.

@ahl
Copy link
Collaborator

ahl commented Jan 6, 2025

I noticed you added your copyright; this seems like what would qualify as a de minimis change; if you feel otherwise let us know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants